//
//  marker.swift
//  amap
//
//  Created by James Karl on 2019/9/14.
//

import Foundation
import MAMapKit

public struct AnnotationViewData {
    public var alpha: Float? = nil
    public var anchorU: Float? = nil
    public var anchorV: Float? = nil
    public var draggable: Bool? = nil
    public var icon: String? = nil //todo
    public var infoWindowOffsetX: Int? = nil
    public var infoWindowOffsetY: Int? = nil
    public var infoWindowEnable: Bool? = nil
    public var period: Int? = nil
    public var position: LatLngData? = nil
    public var rotateAngle: Double? = nil
    public var snippet: String? = nil
    public var title: String? = nil
    public var zIndex: Double? = nil
    public var visible: Bool? = nil
    public var flat: Bool? = nil
    public var extra: Any? = nil
    public var gps: Bool? = nil
    
    init?(json: [String: Any?]) {
        self.alpha = json["alpha"] as? Float;
        self.anchorU = json["anchorU"] as? Float;
        self.anchorV = json["anchorV"] as? Float;
        self.draggable = json["draggable"] as? Bool;
        self.icon = json["icon"] as? String;
        self.infoWindowOffsetX = json["infoWindowOffsetX"] as? Int;
        self.infoWindowOffsetY = json["infoWindowOffsetY"] as? Int;
        self.infoWindowEnable = json["infoWindowEnable"] as? Bool;
        self.period = json["period"] as? Int;
        if let pos = json["position"] as? [String: Any?]{
            self.position = LatLngData(json: pos)
        }
        self.rotateAngle = json["rotateAngle"] as? Double;
        self.snippet = json["snippet"] as? String;
        self.title = json["title"] as? String;
        self.zIndex = json["zIndex"] as? Double;
        self.visible = json["visible"] as? Bool;
        self.flat = json["flat"] as? Bool;
        self.gps = json["gps"] as? Bool;
        self.extra = json["extra"] as Any?;
    }
    
}
